import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEDataQuery } from '../ds/ipsdedata-query';
import { IPSDEOPPriv } from './ipsdeoppriv';
import { IPSDEOPPrivRole } from './ipsdeoppriv-role';
import { IPSDEUserRoleOPPriv } from './ipsdeuser-role-oppriv';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEOPPrivRoleImpl extends PSModelObjectImpl implements IPSDEOPPrivRole, IPSDEUserRoleOPPriv {
  get codeName(): string {
    return this.M.codeName;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  get dataAccessAction(): string {
    return this.M.dataAccessAction;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdedataquery: IPSDEDataQuery | null = null;

  getPSDEDataQuery(): IPSDEDataQuery | null {
    if (this.psdedataquery != null) return this.psdedataquery;
    const value = this.M.getPSDEDataQuery;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdedataquery = ipsdataentity.findPSDEDataQuery(value);
    }
    return this.psdedataquery;
  }

  get psDEDataQuery(): IPSDEDataQuery | null {
    return this.getPSDEDataQuery();
  }

  getPSDEDataQueryMust(): IPSDEDataQuery {
    const value = this.getPSDEDataQuery();
    if (value == null) {
      throw new Error('未指定实体数据查询');
    }
    return value;
  }

  protected psdeoppriv: IPSDEOPPriv | null = null;

  getPSDEOPPriv(): IPSDEOPPriv | null {
    if (this.psdeoppriv != null) return this.psdeoppriv;
    const value = this.M.getPSDEOPPriv;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdeoppriv = ipsdataentity.findPSDEOPPriv(value);
    }
    return this.psdeoppriv;
  }

  get psDEOPPriv(): IPSDEOPPriv | null {
    return this.getPSDEOPPriv();
  }

  getPSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getPSDEOPPriv();
    if (value == null) {
      throw new Error('未指定实体操作标识');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEOPPrivRoleImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.priv.IPSDEOPPrivRole' || cls == 'dataentity.priv.IPSDEUserRoleOPPriv') return true;
    return super.instanceof(cls);
  }
}
